-
Notifications
You must be signed in to change notification settings - Fork 726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mock: document public APIs in the field
module
#2443
Conversation
This change adds documentation to the `field` module and all the public APIs within it. This includes doctests on all the methods which serve as examples. Additionally, the `field::msg` function (which constructs a field with name "message" and the provided value) was moved to `expect::message`. This is part of a unification of all expectation constructors inside the `expect` module. Refs: #539
Was previously `field::msg`.
tracing-mock/src/field.rs
Outdated
/// If we include `only` on the `ExpectedField` then the test | ||
/// will fail: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// If we include `only` on the `ExpectedField` then the test | |
/// will fail: | |
/// The following example fails because [`ExpectedField::only`] is called: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worded this a bit differently because the difference between the 2 examples is now that the second example records an additional field.
Co-authored-by: David Barsky <me@davidbarsky.com>
Co-authored-by: David Barsky <me@davidbarsky.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidbarsky I've added your changes and made the suggested changes to the docs for only()
.
There was just one place in the only()
docs where I felt that they didn't fit. Please let me know what you think.
tracing-mock/src/field.rs
Outdated
/// If we include `only` on the `ExpectedField` then the test | ||
/// will fail: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worded this a bit differently because the difference between the 2 examples is now that the second example records an additional field.
This change adds documentation to the tracing-mock `field` module and all the public APIs within it. This includes doctests on all the methods which serve as examples. Additionally, the `field::msg` function (which constructs a field with name "message" and the provided value) was moved to `expect::message`. This is part of a unification of all expectation constructors inside the `expect` module. Refs: #539 Co-authored-by: David Barsky <me@davidbarsky.com>
This change adds documentation to the tracing-mock `field` module and all the public APIs within it. This includes doctests on all the methods which serve as examples. Additionally, the `field::msg` function (which constructs a field with name "message" and the provided value) was moved to `expect::message`. This is part of a unification of all expectation constructors inside the `expect` module. Refs: #539 Co-authored-by: David Barsky <me@davidbarsky.com>
This change adds documentation to the tracing-mock `field` module and all the public APIs within it. This includes doctests on all the methods which serve as examples. Additionally, the `field::msg` function (which constructs a field with name "message" and the provided value) was moved to `expect::message`. This is part of a unification of all expectation constructors inside the `expect` module. Refs: #539 Co-authored-by: David Barsky <me@davidbarsky.com>
This change adds documentation to the tracing-mock `field` module and all the public APIs within it. This includes doctests on all the methods which serve as examples. Additionally, the `field::msg` function (which constructs a field with name "message" and the provided value) was moved to `expect::message`. This is part of a unification of all expectation constructors inside the `expect` module. Refs: #539 Co-authored-by: David Barsky <me@davidbarsky.com>
This change adds documentation to the tracing-mock `field` module and all the public APIs within it. This includes doctests on all the methods which serve as examples. Additionally, the `field::msg` function (which constructs a field with name "message" and the provided value) was moved to `expect::message`. This is part of a unification of all expectation constructors inside the `expect` module. Refs: #539 Co-authored-by: David Barsky <me@davidbarsky.com>
Motivation
There has been interest around publishing tracing-mock to crates.io
for some time. In order to make this possible, documentation and some
code clean up is needed.
The
field
module needs documentation and examples.Solution
This change adds documentation to the
field
module and all the publicAPIs within it. This includes doctests on all the methods which serve as
examples.
Additionally, the
field::msg
function (which constructs a field withname "message" and the provided value) was moved to
expect::message
.This is part of a unification of all expectation constructors inside the
expect
module.Refs: #539